package com.stylefeng.guns.rest.modular.VO;

import lombok.Data;

/**
 * @author huangliusong
 * @since 2019/1/8
 * {@link }
 */
@Data
public class ResponseVO<M> {
    //s
    private int status;
    //return message
    private String msg;

    private M data;

    private String imgPre;

    private  ResponseVO(){

    }

    public static<M> ResponseVO success(String imgPre,M m){
        ResponseVO responseVO=new ResponseVO();
        responseVO.setStatus(0);
        responseVO.setData(m);
        responseVO.setImgPre(imgPre);
        return responseVO;
    }

    public static<M> ResponseVO success(M m){
        ResponseVO responseVO=new ResponseVO();
        responseVO.setStatus(0);
        responseVO.setData(m);
        return responseVO;
    }


    public static<M> ResponseVO success(String message){
        ResponseVO responseVO=new ResponseVO();
        responseVO.setStatus(0);
        responseVO.setData(message);
        return responseVO;
    }

    public static<M> ResponseVO serviceFail(String msg){
        ResponseVO responseVO=new ResponseVO();
        responseVO.setStatus(1);
        responseVO.setMsg(msg);
        return responseVO;
    }



    public static<M> ResponseVO appFail(String msg){
        ResponseVO responseVO=new ResponseVO();
        responseVO.setStatus(2);
        responseVO.setMsg(msg);
        return responseVO;
    }


}
